<template>
<view class="content">
	<textarea style="width: 670upx; height: 400upx; margin: 60upx auto 0; border: solid 1px #d2d2d2; border-radius: 10upx; padding: 26upx; box-sizing: border-box;"
		:maxlength="300" @input="inputValue" placeholder="请您留下意见或者建议"></textarea>
	<view style="font-size: 20upx; color: #cdcdcd; line-height: 30upx; font-weight: bold; width: 670upx; margin: 10upx auto;">您的反馈我们会尽快解决，但无法保证每一条都能及时反馈，如果有紧急咨询，请直接拨打客服电话：400-003-9881</view>
	<view style="width: 400upx; height: 110upx; background-image: linear-gradient(209deg, #ef6e2a 0%, #ed7739 50%, #ea7f48 100%), linear-gradient(#000000, #000000);
		box-shadow: 0upx 3upx 17upx 1upx rgba(239, 146, 98, 0.33); border-radius: 55upx; font-size: 36upx; font-weight: bold; line-height: 110upx;
		color: #FFF; margin: 200upx auto 0; text-align: center;" @click="submit">提交</view>
</view>
</template>

<script>
import { HTTP } from '../../http.js';
let http = new HTTP;
export default {
	data() {
		return {
			yijian: ''
		}
	},
	methods: {
		inputValue(e) {
			this.yijian = e.target.value;
		},
		submit(){		
			let guestbook=this.yijian;
			if(guestbook.replace(/\s/g,'')==''){
				uni.showToast({ icon: 'none', title: '请填写你的意见或建议!', duration: 2000 });
			}else{
				let user = uni.getStorageSync('user');
				uni.showLoading({ title: '加载中' });
				http.request({
					url: `UserFeedbackController/addUserFeedback?a=a`,
					method: 'post',
					data: { guestbook, status: 0, userId: user.userId },
					success: (res)=>{				
						uni.hideLoading();
						uni.navigateBack({ delta: 1, success: ()=>uni.showToast({ icon: 'none', title: '感谢您的反馈，电小童会努力做的更好！', duration: 2000 }) });
					},
					fail: ()=>{								
						uni.hideLoading();
					}
				});				
			}
		}
	},
	onLoad() {}
}
</script>

<style>
.content {
	height: 100%;
	position: relative;
	background: #f7f7f7;
	font-size: 30upx;
	overflow: hidden;
}
</style>
